using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_Communication_DownloadRecord_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.Communication.DownloadRecord);
            args = new Type[]{};
            method = type.GetMethod("get_Compelete", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Compelete_0);
            args = new Type[]{typeof(System.Int32)};
            method = type.GetMethod("Reset", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Reset_1);
            args = new Type[]{typeof(System.Int32), typeof(System.Byte[])};
            method = type.GetMethod("Reset", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Reset_2);
            args = new Type[]{typeof(System.Int32)};
            method = type.GetMethod("WriteRecord", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, WriteRecord_3);
            args = new Type[]{};
            method = type.GetMethod("MoveNext", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, MoveNext_4);
            args = new Type[]{};
            method = type.GetMethod("get_Position", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Position_5);
            args = new Type[]{};
            method = type.GetMethod("GetNextPart", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetNextPart_6);
            args = new Type[]{};
            method = type.GetMethod("Begin", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Begin_7);

            field = type.GetField("buf", flag);
            app.RegisterCLRFieldGetter(field, get_buf_0);
            app.RegisterCLRFieldSetter(field, set_buf_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_buf_0, AssignFromStack_buf_0);
            field = type.GetField("AllPart", flag);
            app.RegisterCLRFieldGetter(field, get_AllPart_1);
            app.RegisterCLRFieldSetter(field, set_AllPart_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_AllPart_1, AssignFromStack_AllPart_1);


            app.RegisterCLRCreateDefaultInstance(type, () => new huqiang.Communication.DownloadRecord());
            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.Communication.DownloadRecord[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }


        static StackObject* get_Compelete_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Communication.DownloadRecord instance_of_this_method = (huqiang.Communication.DownloadRecord)typeof(huqiang.Communication.DownloadRecord).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Compelete;

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static StackObject* Reset_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @allpart = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Communication.DownloadRecord instance_of_this_method = (huqiang.Communication.DownloadRecord)typeof(huqiang.Communication.DownloadRecord).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Reset(@allpart);

            return __ret;
        }

        static StackObject* Reset_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Byte[] @dat = (System.Byte[])typeof(System.Byte[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Int32 @allpart = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            huqiang.Communication.DownloadRecord instance_of_this_method = (huqiang.Communication.DownloadRecord)typeof(huqiang.Communication.DownloadRecord).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Reset(@allpart, @dat);

            return __ret;
        }

        static StackObject* WriteRecord_3(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @part = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Communication.DownloadRecord instance_of_this_method = (huqiang.Communication.DownloadRecord)typeof(huqiang.Communication.DownloadRecord).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.WriteRecord(@part);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static StackObject* MoveNext_4(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Communication.DownloadRecord instance_of_this_method = (huqiang.Communication.DownloadRecord)typeof(huqiang.Communication.DownloadRecord).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.MoveNext();

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static StackObject* get_Position_5(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Communication.DownloadRecord instance_of_this_method = (huqiang.Communication.DownloadRecord)typeof(huqiang.Communication.DownloadRecord).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Position;

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static StackObject* GetNextPart_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Communication.DownloadRecord instance_of_this_method = (huqiang.Communication.DownloadRecord)typeof(huqiang.Communication.DownloadRecord).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.GetNextPart();

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static StackObject* Begin_7(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Communication.DownloadRecord instance_of_this_method = (huqiang.Communication.DownloadRecord)typeof(huqiang.Communication.DownloadRecord).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Begin();

            return __ret;
        }


        static object get_buf_0(ref object o)
        {
            return ((huqiang.Communication.DownloadRecord)o).buf;
        }

        static StackObject* CopyToStack_buf_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Communication.DownloadRecord)o).buf;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_buf_0(ref object o, object v)
        {
            ((huqiang.Communication.DownloadRecord)o).buf = (System.Byte[])v;
        }

        static StackObject* AssignFromStack_buf_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Byte[] @buf = (System.Byte[])typeof(System.Byte[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Communication.DownloadRecord)o).buf = @buf;
            return ptr_of_this_method;
        }

        static object get_AllPart_1(ref object o)
        {
            return ((huqiang.Communication.DownloadRecord)o).AllPart;
        }

        static StackObject* CopyToStack_AllPart_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Communication.DownloadRecord)o).AllPart;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_AllPart_1(ref object o, object v)
        {
            ((huqiang.Communication.DownloadRecord)o).AllPart = (System.Int32)v;
        }

        static StackObject* AssignFromStack_AllPart_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int32 @AllPart = ptr_of_this_method->Value;
            ((huqiang.Communication.DownloadRecord)o).AllPart = @AllPart;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new huqiang.Communication.DownloadRecord();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
